<title>邮件设置</title>

<div class="layui-card layadmin-header">
  <div class="layui-breadcrumb" lay-filter="breadcrumb">
    <a lay-href="">主页</a>
    <a><cite>系统设置</cite></a>
    <a><cite>邮件设置</cite></a>
  </div>
</div>
  
<div class="layui-fluid">
  <div class="layui-row layui-col-space15">
    <div class="layui-col-md12">
      <div class="layui-card">
        <div class="layui-card-header">邮件设置</div>
        <div class="layui-card-body" pad15>
          
          <form class="layui-form layui-form-module" action="{:url('/email/index')}" method="post">

            <div class="layui-form-item">
              <label class="layui-form-label">邮件发送</label>
              <div class="layui-input-inline">
                <input type="radio" name="open" value="1" title="开启" {if $data.open eq 1}checked{/if}>
                <input type="radio" name="open" value="0" title="关闭" {if $data.open eq 0}checked{/if}>
              </div>
              <div class="layui-form-mid layui-word-aux">开启后可以给用户发送电子邮件。</div>
            </div>
            
            <div class="layui-form-item">
              <label class="layui-form-label">SMTP服务器</label>
              <div class="layui-input-inline">
                <input type="text" name="host" value="{$data.host}" lay-verify="required" autocomplete="off" class="layui-input">
              </div>
            </div>
            
            <div class="layui-form-item">
              <label class="layui-form-label">SMTP端口</label>
              <div class="layui-input-inline">
                <input type="text" name="port" value="{$data.port}" autocomplete="off" class="layui-input">
              </div>
              <div class="layui-form-mid layui-word-aux">默认不需修改，SMTP服务器为smtp.qq.com时请设置端口号25。</div>
            </div>
            
            <div class="layui-form-item">
              <label class="layui-form-label">发信人邮箱</label>
              <div class="layui-input-inline">
                <input type="text" name="sender" value="{$data.sender}" lay-verify="required|email" autocomplete="off" class="layui-input">
              </div>
            </div>

            <div class="layui-form-item">
              <label class="layui-form-label">SMTP用户身份验证</label>
              <div class="layui-input-inline">
                <input type="radio" name="auth" value="1" title="开启" {if $data.auth eq 1}checked{/if}>
                <input type="radio" name="auth" value="0" title="关闭" {if $data.auth eq 0}checked{/if}>
              </div>
              <div class="layui-form-mid layui-word-aux">如果SMTP服务器要求通过身份验证才可以发邮件，请选择"开启"。</div>
            </div>
            
            <div class="layui-form-item">
              <label class="layui-form-label">账号</label>
              <div class="layui-input-inline">
                <input type="text" name="account" value="{$data.account}" autocomplete="off" class="layui-input">
              </div>
            </div>

            <div class="layui-form-item">
              <label class="layui-form-label">密码</label>
              <div class="layui-input-inline">
                <input type="password" name="password" value="{$data.password}" autocomplete="off" class="layui-input">
              </div>
            </div>
            
            <div class="layui-form-item">
              <div class="layui-input-block">
                <button class="layui-btn" lay-submit lay-filter="J_ajax_submit_btn"><i class="layui-icon layui-icon-ok-circle"></i>提交</button>
                <a href="#J_view" class="layui-btn layui-btn-primary J_popup" title="测试邮件"><i class="layui-icon layui-icon-email" style="color: #777;"></i>测试邮件</a>
              </div>
            </div>
          </form>
          
        </div>
      </div>
    </div>
  </div>
</div>

<script>
;!function(){
  var form = layui.form;
  form.render();
}();
</script>

<script type="text/html" id="J_view">
<form class="layui-form" action="{:url('/email/test')}" method="post">

            <div class="layui-form-item">
              <label class="layui-form-label">收件人</label>
              <div class="layui-input-inline">
                <input type="text" name="toEmail" value="" lay-verify="required|email" class="layui-input">
              </div>
            </div>
 
              <div class="layui-form-item">
              <label class="layui-form-label">邮件标题</label>
              <div class="layui-input-inline">
                <input type="text" name="title" value="测试邮件" placeholder="请输入标题" class="layui-input" lay-verify="required">
              </div>
            </div>
            
             <div class="layui-form-item">
              <label class="layui-form-label">邮件内容</label>
              <div class="layui-input-inline">
                <textarea name="content" value="" placeholder="请输入内容" class="layui-textarea" lay-verify="required">恭喜您，如果您收到此邮件则代表后台邮件发送设置正确！</textarea>
              </div>
            </div>

            <div class="layui-form-item">
              <div class="layui-input-block">
                <button class="layui-btn" lay-submit lay-filter="J_ajax_submit_btn"><i class="layui-icon layui-icon-ok-circle"></i>提交</button>
              </div>
            </div>
            
          </form>
</script>